var switchPanel = function(first) {
	if (first) {
		$('#container2').hide();
		$('#container').show();
	} else {
		$('#container').hide();
		$('#container2').show();
	}

};

//$('#dateValue').change(function(){
//	
//});
$(document).ready(

function() {
	$('#container2').hide();
	
	$(".TabbedPanelsTab").each(function(index) {
		$(this).click(function() {
			switch (index) {
			case 0:// 曝光數
			// alert('曝光數');
				status = 0;
				switchPanel(true);
				type=0;
				// panel.store=store;
				// store.proxy.url="/ad/sys/com/control/publish/ClickedAdService.php?action=getStatisticsCountDate";
				storeReload(Ext.get("dateValue").dom.value);
				break;
			case 1:// 點擊數
			// alert('點擊數');
				status = 1;
				switchPanel(true);
				type=1;
				// panel.store=store;
				// store.proxy.url="/ad/sys/com/control/publish/ClickedAdService.php?action=getStatisticsCountDate";
				storeReload(Ext.get("dateValue").dom.value);
				break;
			case 3:// 點擊率
			// alert('點擊率');
				status = 0;
				type=2;
				switchPanel(false);
				// store.proxy.url="/ad/sys/com/control/publish/ClickedAdService.php?action=getStatisticsRatioDate";
				// panel.items.store=store2;
				storeReload2(Ext.get("dateValue").dom.value);
				break;
			case 2:// 曝光率
			// alert('曝光率');
				status = 1;
				type=3;
				switchPanel(false);
				// store.proxy.url="/ad/sys/com/control/publish/ClickedAdService.php?action=getStatisticsRatioDate";
				// panel.store=store2;
				storeReload2(Ext.get("dateValue").dom.value);
				break;
			}
		});
	});
	
});
